<?php
/* 
* @Title:  [商品评论控制器]
* @Author: {chenlei} [chenleib5@126.com]
* @Date:   2014-04-27 19:36:47
* @Last Modified by:   Administrator
* @Last Modified time: 2014-04-27 22:11:29
* @Copyright:  [hn7m.com]
*/
class CommentControl extends CommonControl{
	private $model=NULL;
	/**
	 * [__init 自动加载模型类]
	 * @return [type] [description]
	 */
	public function __init(){
		parent::__init();
		$this->model=K('Comment');
	}
	/**
	 * [index 默认显示评论列表]
	 * @return [type] [description]
	 */
	public function index(){
		$comment=$this->model->get_data($where=NULL,$order=NULL);
		$this->assign('comment',$comment);
		$this->display();
	}
	/**
	 * [ajax_del_comment 异步删除评论]
	 * @return [type] [description]
	 */
	public function ajax_del_comment(){
		if(IS_AJAX){
			$mid=Q('mid',0,'intval');
			if($this->model->del_data(array('mid'=>$Modified))){
				$return=array(
					'state'		=>1,
					'message'	=>'删除成功!',
					'timeout'	=>3
					);
				$this->ajax($return);
			}
		}
	}
	/**
	 * [del_comment 删除评论]
	 * @return [type] [description]
	 */
	public function del_comment(){
		$gid=Q('get.gid');
		if($this->model->del_data(array('qm_goods_gid'=>$gid))){
			$this->success('商品评价相关数据删除成功',U('Goods/index'));
		}else{
			go(U('Goods/index'));
		}
	}
}
?>